package edu.cuit.avatar.接口.computer;

/**
 * @author <a href="mailto:1020zhaodan@163.com">Adan</a>
 * @version 1.0
 * @date 2025/7/10 14:25
 */
public class Computer {
    private MainBoard mainBoard;

    public Computer(MainBoard mainBoard) {
        this.mainBoard = mainBoard;
    }

    public void start(){
        mainBoard.start();
    }

    public void work(){
        if(mainBoard.havePower()) {
            for (int i = 0; i < 100; i++)
                System.out.print(i + " ");
            System.out.println();
        }
    }

    public String getSetting(){
        return String.format("main board:%s\r\ncpu:%s\r\nram:%s\r\nprice:%d\r\n",
                mainBoard.getName(), mainBoard.getCpu().getName(), mainBoard.getRam().getName(), getPrice());
    }

    public int getPrice(){
        return mainBoard.getPrice()
                + mainBoard.getCpu().getPrice()
                + mainBoard.getRam().getPrice();
    }
}
